//
//  FIYYBaseRequest.h
//  Magpie
//
//  Created by 100TV protocal on 12-11-14.
//
//

#import "FIBaseRequest.h"

//返回值得是否有效
#define validResponse(response)\
{ \
if(response==nil || [response isKindOfClass:[NSError class]] || ![response isKindOfClass:[NSObject class]]){ return response; } \
id json=[response JSONValue];	\
if(nil == json){	\
return nil;	\
}	\
id error_response = [json objectForKey:@"error_response"];	\
if(nil != error_response){	\
NSString *message = [error_response objectForKey:@"message"];	\
NSInteger intteger = [[error_response objectForKey:@"code"] intValue];	\
NSError *error = [[NSError alloc]  initWithDomain:@"YKDataSourceDomain" code:intteger userInfo:[NSDictionary dictionaryWithObjectsAndKeys:message,NSLocalizedDescriptionKey,@"json",json,nil]];	\
return [error autorelease];	\
} }

/*
 从字符串中解析出日期，使用东八时区
 str: yyyy-MM-dd HH:mm:ss
 */
extern NSDate* parseDateFromString(NSString* str);

@interface FIYYBaseRequest : FIBaseRequest {
    NSString* url;
	NSString* method;
}
@property(nonatomic,retain) NSString* url;
@property(nonatomic,retain) NSString* method;

@end
